package com.waitingresult.common.base.enums;

/**
 * All right reserved,Designed By WangShuai
 *
 * @author : WangShuai
 * @version : V1.0
 * @ClassName : GenderEnum
 * @Description :
 * @date : 2021/9/12 16:00
 */
public enum GenderEnum {

    UNKNOW(0, "保密"),

    MALE(1, "男"),

    FEMALE(2, "女");

    private final Integer key;

    private final String value;

    GenderEnum(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    /**
     * 通过可以获取values
     *
     * @param key
     * @return
     */
    public static String getValue(Integer key) {
        for (GenderEnum em : GenderEnum.values()) {
            if (em.key.equals(key)) {
                return em.value;
            }
        }
        return null;
    }

    /**
     * 判断key是否存在
     *
     * @param key
     * @return
     */
    public static boolean exists(Integer key) {
        for (GenderEnum em : GenderEnum.values()) {
            if (em.key.equals(key)) {
                return true;
            }
        }
        return false;
    }

    public Integer getKey() {
        return this.key;
    }

    public String getValue() {
        return this.value;
    }
}
